﻿package mortal.game.scene3D.player.item
{
    import baseEngine.modifiers.*;
    import com.mui.controls.*;
    import flash.text.*;
    import mortal.common.global.*;
    import mortal.game.scene3D.display3d.text3d.dynamicText3d.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.model.pools.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.view.common.*;

    public class BasePlayer extends Game2DPlayer
    {
        private var _effectPlayer:EffectPlayer;
        private var _textField:GTextFiled;
        private var _text3D:Text3D;

        public function BasePlayer()
        {
            return;
        }// end function

        protected function initPlayer(param1:String) : void
        {
            if (!this._effectPlayer)
            {
                this._effectPlayer = EffectPlayerPool.instance.getEffectPlayer(param1, this, null, true);
                this._effectPlayer.play(PlayMode.ANIMATION_LOOP_MODE);
            }
            return;
        }// end function

        protected function setTitle(param1:String) : void
        {
            if (!this._textField)
            {
                this._textField = UIFactory.textField("", 0, 0, -1, -1, null, GlobalStyle.textFormatItemWhite);
                this._textField.autoSize = TextFieldAutoSize.LEFT;
                this._textField.htmlText = param1;
                this._text3D = Text3DFactory.instance.createtext3D(this._textField, false, this);
            }
            else
            {
                this._textField.htmlText = param1;
                Text3DFactory.instance.updateText3D(this._text3D, this._textField, this);
            }
            this.layOut();
            return;
        }// end function

        protected function layOut() : void
        {
            this._text3D.x = (-this._text3D.textWidth) / 1.7;
            this._text3D.y = 150;
            return;
        }// end function

        public function set url(param1:String) : void
        {
            this.initPlayer(param1);
            return;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            if (this._effectPlayer)
            {
                this._effectPlayer.dispose(param1);
                this._effectPlayer.parent = null;
            }
            this._effectPlayer = null;
            if (this._text3D)
            {
                Text3DFactory.instance.disposeText3D(this._text3D);
                this._text3D = null;
            }
            if (this._textField)
            {
                this._textField.dispose();
                this._textField = null;
            }
            super.dispose(param1);
            return;
        }// end function

    }
}
